﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration.Provider;

namespace Intergr8.Data
{
    /// <summary>
    /// The data provider collection class
    /// </summary>
    /// <remarks>
    /// <para>
    /// The data provider collection class is the portion of your implementation that 
    /// takes care of provider configuration. Here you implement the behavior of your 
    /// configuration elements for a list of providers. 
    ///</para>
    /// <para>
    /// To implement the data provider collection class you need to derive it from the 
    /// System.Configuration.ProviderCollection base class. ProviderCollection is a 
    /// class that exposes some properties and methods to work with the list of various 
    /// data providers declared in your configuration file. This class is simply a collection 
    /// class that implements the ICollection and IEnumerable base interfaces, 
    /// so there isn't any major point to mention about it. 
    ///</para>
    /// <para>
    /// The key point here is overriding the default behavior of the ProviderCollection 
    /// class in order to return an instance of your main data provider class for a specified
    /// index.
    /// </para>
    /// </remarks>
    public class DataProviderCollection : ProviderCollection
    {

        /// <summary>
        /// Return an instance of DataProvider   
        /// for a specified provider name 
        /// </summary>
        /// <param name="name">string name of the provider</param>
        /// <returns>DataProvider object</returns>
        public new DataProvider this[string name]
        {
            get { return (DataProvider)base[name]; }
        }
    }
}
